package com.iule.common.playboy.service;

import com.alibaba.fastjson.JSONObject;

import java.util.List;

/**
 * 配置中心核心类
 * The core Class of Configure Center
 * @author 柚子 bacchusgift@outlook.com
 * @copyright 爱游乐科技有限公司
 * @date {2020/3/16}
 */
public interface ConfigCoreService {


    /**
     * 根据指定的key和条件获取一条配置项，其中若有多条同样配置，取创建时间最近的配置项
     * Get the configuration item according to the specified key and condition.
     * If there are more than one of the same configurations, get the most recent configuration item
     * @param key the key of configuration item 配置项key
     * @param conditions the map of condition 条件列表 -e.g : { "version": "1.0.1", "channel": "oppo" }
     * @return 配置项
     */
    Object getNewestConfig(String key, JSONObject conditions);


    /**
     * 根据指定的key和条件获取多条配置项
     * Gets  configuration items according to the specified key and condition.
     * @param conditions the map of condition 条件列表 -e.g : { "version": "1.0.1", "channel": "oppo" }
     * @param key the key of configuration item 配置项key
     * @return 配置项列表
     */
    List<Object> getConfigs(JSONObject conditions,String...key);

}
